/**
 * Personal Digital Assistance
 * 
 * 2010-9-14
 * 
 */

/**
 * @author Kevin Hanson
 *
 */
package pda;

import javax.swing.*;
import javax.swing.border.*;

import java.awt.*;
import java.sql.*;

import note.NotePanel;
import database.Database;

public class PDA {
/*	static String[] tools = {
		"Calendar", "Note", "Diary", "Log", "Finance"
	};

	private JMenuBar createMenuBar() {
		JPopupMenu.setDefaultLightWeightPopupEnabled(false);
		JMenuBar menuBar = new JMenuBar();
		
		JMenu file = (JMenu)menuBar.add(new JMenu("File"));
		JMenuItem fileMI0 = (JMenuItem)file.add(new JMenuItem("Open"));
		file.add(new JSeparator());
		JMenuItem fileMI1 = (JMenuItem)file.add(new JMenuItem("Exit"));
		
		JMenu options = (JMenu)menuBar.add(new JMenu("Options"));
		JMenuItem optionsMI = (JMenuItem)options.add(new JMenuItem("Date"));
		
		return menuBar;
	}

	private JTabbedPane createTabbedPane() {
		JTabbedPane tabbedPane = new JTabbedPane();
		tabbedPane.setTabPlacement(JTabbedPane.LEFT);
		
		tabbedPane.addTab(tools[1], new NotePanel());
		//tabbedPane.addTab(tools[1], new NotePanel());
		//tabbedPane.addTab(tools[2], new NotePanel());
		//tabbedPane.addTab(tools[3], new NotePanel());
		for (int i = 2; i < tools.length; i++) {
			tabbedPane.addTab(tools[i], null);
		}
		tabbedPane.addTab("Tab " + tools.length, new JCheckBox());
		
		return tabbedPane;
	}

	private void createAndShowGUI() {
		int WIDTH = 1200, HEIGHT = 600;
		//JFrame mainFrame = new JFrame("PDA");
		setSize(WIDTH, HEIGHT);
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
		mainFrame.setLocation((d.width - WIDTH) / 2, (d.height - HEIGHT) / 2);
		JOptionPane.setRootFrame(mainFrame);

		JPanel p = new JPanel() {
			public Insets getInsets() {
				return new Insets(0, 0, 0, 0);	// Border margin
			}
		};
		p.setSize(WIDTH, WIDTH);
		p.setLayout(new BorderLayout());
		p.setBorder(new EtchedBorder());
		p.add(createMenuBar(), BorderLayout.NORTH);
		p.add(createTabbedPane(), BorderLayout.CENTER);

		mainFrame.setContentPane(p);
		//mainFrame.pack();
		mainFrame.setVisible(true);
	}*/
	public static void main(String[] args) {
		try { // Init database
			Database db = new Database();
		} catch (Exception ex) {
			ex.printStackTrace();
			System.exit(-1);
		}
		MainFrame mainFrame = new MainFrame("PDA");
		JOptionPane.setRootFrame(mainFrame);
		/*
		// Schedule a job for event-dispatching thread:
		// creating and showing this application's GUI
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				createAndShowGUI();
			}
		});
		*/
	}
}


